Search Interview Questions | More than 3000 questions in repository. There are more than 900 unanswered questions. Click here and help us by providing the answer. Have a video suggestion. Click Correct / Improve and please let us know. |
|
| |||||||||||
Interview Questions and Answers - Order By Newest | |||||||||||
| |||||||||||
Ans. public class SingleTon { private SingleTon() { if (singleTon != null) { throw new RuntimeException("cant not create the object"); } } public Object clone() throws CloneNotSupportedException { throw new CloneNotSupportedException("can not be create"); } static private volatile SingleTon singleTon; public static SingleTon getInstance() { SingleTon singleTon = this.sample; if (singleTon == null) { synchronized (this) { singleTon = this.singleTon; if (singleTon == null) { singleTon = this.singleton = new SingleTon(); } } } return singleTon; } } | |||||||||||
Help us improve. Please let us know the company, where you were asked this question : | |||||||||||
Like Discuss Correct / Improve  singleton  design pattern Asked in 2 Companies | |||||||||||
| |||||||||||
Ans. Factory Design Patterns is the pattern that recommends creation of separate Factory Object for creation of other object. So its like saying - If you want to create an object of ClassA, Talk to FactoryObject ( which is an object of FactoryClass ). FactoryObject in itself encapsulates the inputs and logic required to make the decision regarding the creation and construction of object. | |||||||||||
Help us improve. Please let us know the company, where you were asked this question : | |||||||||||
Like Discuss Correct / Improve  design pattern  factory design pattern Asked in 9 Companies | |||||||||||
| |||||||||||
Ans. Both are creational design patterns but singleton facilitates in creation and reuse of single object whereas Factory deals with creation of multiple objects. | |||||||||||
Help us improve. Please let us know the company, where you were asked this question : | |||||||||||
Like Discuss Correct / Improve  Design pattern  singleton  factory  singleton vs factory Asked in 4 Companies | |||||||||||
| |||||||||||
Ans. Factory,Abstract Factory,Singleton,Prototype and Builder | |||||||||||
Help us improve. Please let us know the company, where you were asked this question : | |||||||||||
Like Discuss Correct / Improve  Design Pattrns  Creational Design Patterns Intermediate | |||||||||||
| |||||||||||
Ans. Adapter,Bridge,Composite,Decorator,Facade,Flyweight,Proxy | |||||||||||
Help us improve. Please let us know the company, where you were asked this question : | |||||||||||
Like Discuss Correct / Improve  Design Patterns  Structural Design Patterns Intermediate | |||||||||||
| |||||||||||
Ans. Interpreter,Chain of Responsibility,Command,Iterator,Observer,Mediator,Memento | |||||||||||
Help us improve. Please let us know the company, where you were asked this question : | |||||||||||
Like Discuss Correct / Improve  Behavioral Design Patterns Intermediate | |||||||||||
| |||||||||||
Ans. [Open Ended Answer] | |||||||||||
Help us improve. Please let us know the company, where you were asked this question : | |||||||||||
Like Discuss Correct / Improve  Design Patterns Intermediate | |||||||||||
| |||||||||||
Ans. Builder ( While Writing Unit Tests ) Prototype ( Cloning ) Adapter ( asList , toString ) Chain Of Responsibility ( Logging ) Singleton Factory ( Action Mapping ) Proxy Observer ( Event Listener ) MVC ( Web frameworks ) Filter ( Criteria ) | |||||||||||
Help us improve. Please let us know the company, where you were asked this question : | |||||||||||
Like Discuss Correct / Improve  Design Patterns  widely used Design patterns intermediate   frequent | |||||||||||
Try 1 Question(s) Test | |||||||||||
| |||||||||||
Ans. It is used for intercepting the request. It's primary use is to implement security policy. All or specific request types can be intercepted and hence forwarded to authentication / authorization module so as to facilitate authorized requests to application. | |||||||||||
Help us improve. Please let us know the company, where you were asked this question : | |||||||||||
Like Discuss Correct / Improve  interceptors  interceptor design pattern | |||||||||||
| |||||||||||
Ans. It introduces a layer of adaptations before it reaches the final and desired interface. Moreover sometimes all requests are forwarded to adapter class. Some of such requests doesn't even require any sort of adaptions as they are qualified to call the final interface directly and introducing overheads. | |||||||||||
Help us improve. Please let us know the company, where you were asked this question : | |||||||||||
Like Discuss Correct / Improve  Adapter Design Pattern  design pattern | |||||||||||
| |||||||||||
Ans. Voltage converters / Power Adapters | |||||||||||
Help us improve. Please let us know the company, where you were asked this question : | |||||||||||
Like Discuss Correct / Improve  Adapter Design Pattern  Design Pattern | |||||||||||
| |||||||||||
Ans. Public constructor is simple and easy as it's the default way of object creation. So there are no additional coding overheads as compiler provides the default constructor if none is provided by coder. With static final methods, it facilitates loose coupling by segregating the responsibility of object creation to a separate method. Validation can be done on the constructor arguments before calling it. Moreover if any adaption on the arguments is required that can achieved easily with factory method.On the flip side, there is coding overhead and additional method call. | |||||||||||
Sample Code for constructor Sample Code for factory | |||||||||||
Help us improve. Please let us know the company, where you were asked this question : | |||||||||||
Like Discuss Correct / Improve  constructor  factory design pattern  factory method | |||||||||||
| |||||||||||
This question was recently asked at 'Capgemini'.This question is still unanswered. Can you please provide an answer. | |||||||||||
Help us improve. Please let us know the company, where you were asked this question : | |||||||||||
Like Discuss Correct / Improve  singleton Asked in 1 Companies | |||||||||||
| |||||||||||
Ans. Single gateway of the entire application is called Facade Design Pattern. | |||||||||||
Help us improve. Please let us know the company, where you were asked this question : | |||||||||||
Like Discuss Correct / Improve  design pattern  facade Asked in 1 Companies | |||||||||||
| |||||||||||
This question is still unanswered. Can you please provide an answer. | |||||||||||
Help us improve. Please let us know the company, where you were asked this question : | |||||||||||
Like Discuss Correct / Improve  Design Patterns | |||||||||||
| |||||||||||
This question was recently asked at 'Bloomberg'.This question is still unanswered. Can you please provide an answer. | |||||||||||
Help us improve. Please let us know the company, where you were asked this question : | |||||||||||
Like Discuss Correct / Improve  code  coding  cloning  design pattern   cloning design pattern Asked in 1 Companies | |||||||||||
| |||||||||||
This question was recently asked at 'deutche bank'.This question is still unanswered. Can you please provide an answer. | |||||||||||
Help us improve. Please let us know the company, where you were asked this question : | |||||||||||
Like Discuss Correct / Improve  design pattern   singleton Asked in 1 Companies | |||||||||||
| |||||||||||
Ans. The Model/View/Controller pattern, a strategy for dividing responsibility in a GUI component. The model is the data for the component. The view is the visual presentation of the component on the screen. The controller is responsible for reacting to events by changing the model. According to the MVC pattern, these responsibilities should be handled by different objects. | |||||||||||
Help us improve. Please let us know the company, where you were asked this question : | |||||||||||
Like Discuss Correct / Improve  mvc  design pattern Asked in 1 Companies   rare | |||||||||||
| |||||||||||
Ans. Struts controller uses the Command design pattern and the action classes use the Adapter design pattern. The process() method of the RequestProcessor uses the Template method design pattern. | |||||||||||
Help us improve. Please let us know the company, where you were asked this question : | |||||||||||
Like Discuss Correct / Improve  Struts Design patterns Asked in 1 Companies | |||||||||||
| |||||||||||
| |||||||||||